package org.hawk.gwt.ppc.parser.impl;

import java.util.List;

import org.hawk.gwt.ppc.parser.AnnotationDescriptor;
import org.hawk.gwt.ppc.parser.Descriptor;
import org.hawk.gwt.ppc.parser.ParameterizedMemberDescriptor;
import org.hawk.gwt.ppc.parser.VariableDescriptor;

/**
 * Common methods for constructors and methods implementation.
 * 
 * @author alex.bereznevatiy@gmail.com
 *
 */
abstract class AbstractParameterizedMemberDescriptor extends
		AbstractDescriptorContainer implements ParameterizedMemberDescriptor {
	
	private List<String> modifiers;
	private List<AnnotationDescriptor> annotations;
	private List<VariableDescriptor> parameters;
	private List<String> exceptions;
	private boolean varArgs;

	AbstractParameterizedMemberDescriptor(
			List<String> modifiers,
			List<AnnotationDescriptor> annotations,
			List<VariableDescriptor> parameters,
			List<String> exceptions,
			List<Descriptor> descriptors,
			boolean varArgs) {
		super(descriptors);
		
		this.modifiers = unmodify(modifiers);
		this.annotations = unmodify(annotations);
		this.parameters = unmodify(parameters);
		this.exceptions = unmodify(exceptions);
		this.varArgs = varArgs;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.ParameterizedMemberDescriptor#getParameters()
	 */
	public List<VariableDescriptor> getParameters() {
		return parameters;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.ParameterizedMemberDescriptor#isVarArgs()
	 */
	public boolean isVarArgs() {
		return varArgs;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.ParameterizedMemberDescriptor#getExceptionTypes()
	 */
	public List<String> getExceptionTypes() {
		return exceptions;
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.ModificatedDescriptor#getModifiers()
	 */
	public List<String> getModifiers() {
		return modifiers;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.AnnotatedDescriptor#getAnnotations()
	 */
	public List<AnnotationDescriptor> getAnnotations() {
		return annotations;
	}
}
